#include "RenzoPrecompiled.h"
#include "RenzoCamera.h"
#include "RenzoResourceManager.h"
#include "RenzoBoundingBox.h"

namespace Renzo
{
Camera::Camera(void)
{
	//Renzoderer::instance()->getResourceManager()->registerCreateFunc(CameraType, Camera::create);
}

Camera::~Camera(void)
{
}

Object* Camera::create() {
	return new Camera;
}

//namespace {
	// Register Camera::create() function to ResourceManager creators.
	//Renzoderer::instance()->getResourceManager()->registerCreateFunc(CameraType, Camera::create);
	
//}

void Camera::setView(const Float3& _eye, const Float3& _lookat, const Float3& _up) {
	eye = _eye;
	lookat = _lookat;
	up = _up;
}

void Camera::setViewCenteredBox(const BoundingBox *bb) {
	nearPlane = 0.5 * bb->radius;
	farPlane = bb->radius + bb->dim.length();
}

Float3& Camera::getEye() {
	return eye;
}

Float3& Camera::getLookat() {
	return lookat;
}

Float3& Camera::getUp() {
	return up;
}

float Camera::getNearPlane() {
	return nearPlane;
}

float Camera::getFarPlane() {
	return farPlane;
}

}